# Maintainer: Noel Kuntze <noel.kuntze@thermi.consulting>
pkgname=libvmime
pkgver=0.9.2.175
_commithash=d03ad5f0f6d3b2d54009ccdc7d1f7670218b263c
pkgrel=0
pkgdesc="Library for working with RFC 5322, MIME messages and IMAP/POP/SMTP"
url="https://www.vmime.org/"
arch="all"
license="GPL-3.0-only"
# cmake config file isn't suitable for explicitely setting the TLS lib when it finds gnutls
makedepends="
	!gnutls-dev
	cmake
	cppunit-dev
	doxygen
	graphviz
	gtk+3.0-dev
	libgsasl-dev
	icu-dev
	openssl-dev
	samurai
	"
checkdepends="icu-data-full"
subpackages="$pkgname-dbg $pkgname-dev"
source="$pkgname-$pkgver-$_commithash.tar.gz::https://github.com/kisli/vmime/archive/$_commithash.tar.gz"

options="!check" # test suite fails

builddir="$srcdir/vmime-$_commithash"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B . -G Ninja \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DVMIME_BUILD_TESTS=ON \
		-DVMIME_TLS_SUPPORT_LIB=openssl \
		$CMAKE_CROSSOPTS .
	cmake --build .
}

check() {
	LANG=C.UTF-8 build/bin/run-tests
}

package() {
	DESTDIR="$pkgdir" cmake --install .
}
sha512sums="
a7bf716d23f5f3af05929be31cc68dfd90fa6d3b60d01f38ebfb3c4934263745d62b5f22e654e7176f2edf36e489d3ac0feec81e0f74e7cb43afa615640c4136  libvmime-0.9.2.175-d03ad5f0f6d3b2d54009ccdc7d1f7670218b263c.tar.gz
"
